<?php
class Kid{
	public function addKid($name,$parent_id,$class_id,$age,$height='',$weight='',$avatar=''){
		$sql = "INSERT INTO `kid` VALUES (:id,:parent_id,:class_id,:name,:height,:weight,:age,:avatar)";
		$field = array(':id' => '',
					   ':parent_id' => $parent_id,
					   ':class_id' => $class_id,
					   ':name' => $name,
					   ':height' => $height,
					   ':weight' => $weight,
					   ':age' => $age,
					   ':avatar' => $avatar
					  );

		return DB::updateDB($sql,$field);			  
	}
	
	public function getKid(){
		$DB = new DB();
		$sql = "SELECT
				k.name,k.age,c.title as class,u.username,g.title as grade 
				FROM
				kid k, class c, user u,grade g
				WHERE 
				k.class_id = c.id 
				AND
				k.parent_id=u.id
				AND
				c.grade_id = g.id";
		
		return $DB->fetchAll($sql);
	}
}
?>